iT邦幫忙

0

C++程式碼問題

  • 分享至 

  • xImage
  •  

https://ithelp.ithome.com.tw/upload/images/20200616/20127974pDJyQiUNHn.png](http://)


請問這題該如何解呢??

#include
#include
#include <math.h>

using namespace std;

class NODE
{
public:
string name;
int price;
NODE *next;

NODE(string s, int p) 
{
    name = s;
    price = p;
    next = NULL; 
}

};

NODE *head = NULL;

void BuildLink(void)
{
NODE *pt, *x;

string name[10] = {"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10" };
int price[10] = {12, 15, 8, 10, 13, 8, 10, 12, 16, 0};

string y;
pt = new NODE(name[0], price[0]);
head = pt;
x = pt;

for (int i=1; i<10; i++)
{
    pt = new NODE(name[i], price[i]);
    x->next = pt;
    x = pt;
}

}

int fee(string S, string D)
{
//你的程式碼
}

int main() {
string S, D;
char c;
int money;

NODE* x;

BuildLink();

cin >> S;
cin >> D;
cin >> c;

money = fee(S, D);

if (c == 'Y' || c == 'y')
   money = round(money * 0.8);

cout << money << endl;
return(0);

}


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言